

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;

namespace DataLayer
{
	public class datMultilanguageSettings
	{
		public datMultilanguageSettings()
		{
		}
		
		#region  Code Factory Generated Methods
		public void DeleteMultilanguageSettingsByMultiLanguageSettingId(entMultilanguageSettings parEntMultilanguageSettings, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pMultiLanguageSettingId",parEntMultilanguageSettings.MultiLanguageSettingId);
			parDbConnector.ExecuteNonQuery("DeleteMultilanguageSettingsByMultiLanguageSettingId",insDbParamCollection);
		}
		public void InsertMultilanguageSettings(entMultilanguageSettings parEntMultilanguageSettings, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pPageId",parEntMultilanguageSettings.PageId);
			insDbParamCollection.Add("@pControlId",parEntMultilanguageSettings.ControlId);
			insDbParamCollection.Add("@pLanguageId",parEntMultilanguageSettings.LanguageId);
			insDbParamCollection.Add("@pControlText",parEntMultilanguageSettings.ControlText);
			insDbParamCollection.AddOutput("@pMultiLanguageSettingId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertMultilanguageSettings",insDbParamCollection);
			parEntMultilanguageSettings.MultiLanguageSettingId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}
		public void UpdateMultilanguageSettingsByMultiLanguageSettingId(entMultilanguageSettings parEntMultilanguageSettings, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pMultiLanguageSettingId",parEntMultilanguageSettings.MultiLanguageSettingId);
			
			insDbParamCollection.Add("@pPageId",parEntMultilanguageSettings.PageId);
			insDbParamCollection.Add("@pControlId",parEntMultilanguageSettings.ControlId);
			insDbParamCollection.Add("@pLanguageId",parEntMultilanguageSettings.LanguageId);
			insDbParamCollection.Add("@pControlText",parEntMultilanguageSettings.ControlText);
			parDbConnector.ExecuteNonQuery("UpdateMultilanguageSettingsByMultiLanguageSettingId",insDbParamCollection);
		}

		public void SelectMultilanguageSettingsByMultiLanguageSettingId(entMultilanguageSettings parEntMultilanguageSettings, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pMultiLanguageSettingId",parEntMultilanguageSettings.MultiLanguageSettingId);
			DataTable insDataTable = new DataTable();
			insDataTable = parDbConnector.ExecuteDataTable("SelectMultilanguageSettingsByMultiLanguageSettingId",insDbParamCollection);
			if (insDataTable.Rows.Count>0)
			{
				if (insDataTable.Rows[0]["MultiLanguageSettingId"]!=DBNull.Value)
				{
					parEntMultilanguageSettings.MultiLanguageSettingId = Convert.ToInt32(insDataTable.Rows[0]["MultiLanguageSettingId"]);
				}
				if (insDataTable.Rows[0]["PageId"]!=DBNull.Value)
				{
					parEntMultilanguageSettings.PageId = Convert.ToInt32(insDataTable.Rows[0]["PageId"]);
				}
				if (insDataTable.Rows[0]["ControlId"]!=DBNull.Value)
				{
					parEntMultilanguageSettings.ControlId = insDataTable.Rows[0]["ControlId"].ToString();
				}
				if (insDataTable.Rows[0]["LanguageId"]!=DBNull.Value)
				{
					parEntMultilanguageSettings.LanguageId = Convert.ToInt32(insDataTable.Rows[0]["LanguageId"]);
				}
				if (insDataTable.Rows[0]["ControlText"]!=DBNull.Value)
				{
					parEntMultilanguageSettings.ControlText = insDataTable.Rows[0]["ControlText"].ToString();
				}
			}
		}

		#endregion

        public DataTable SelectMultilanguageSettingsByLanguageIdAndPageId(entMultilanguageSettings parEntMultilanguageSettings,DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pLanguageId", parEntMultilanguageSettings.LanguageId);
            insDbParamCollection.Add("@pPageId", parEntMultilanguageSettings.PageId);
            return parDbConnector.ExecuteDataTable("SelectMultilanguageSettingsByLanguageIdAndPageId", insDbParamCollection);
        }
        public void DeleteMultilanguageSettingsByPageId(entMultilanguageSettings parEntMultilanguageSettings, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pPageId", parEntMultilanguageSettings.PageId);
            parDbConnector.ExecuteNonQuery("DeleteMultilanguageSettingsByPageId", insDbParamCollection);
        }
	}
}